/*
 * @Description: 
 * @Author: zoe
 * @Date: 2024-09-13 20:03:57
 * @LastEditors: rendc
 * @LastEditTime: 2024-09-13 20:09:20
 */
public class Duration{
    private int hours;
    private int minutes;
    private int seconds;
    //三参
    public Duration(int hours,int minutes,int seconds){
        this.hours = hours;
        this.minutes = minutes;
        this.seconds = seconds;
    }
    //一参
    public Duration(int totalSeconds){
        this.hours = totalSeconds / 3600;
        this.minutes = (totalSeconds % 3600) / 60;
        this.seconds = totalSeconds % 60;
    }
    //get
    public int getHours(){
        return hours;
    }
    public int getMinutes(){
        return minutes;
    }
    public int getSeconds(){
        return seconds;
    }
    //返回总秒数
    public int getTotalSeconds(){
        return hours * 3600 + minutes * 60 + seconds;
    }
    //重写、
    @Override
    public String toString(){
        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
    }
}
